package com.ruoyi.edh.domain.vo;

import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("易订货-概要商品的参数对象")
public class EdhSummaryGoodsVo {
    private static final long serialVersionUID = 1L;

    /** 主键id */
    @ApiModelProperty("id")
    private Long id;

    /** 商品编号 */
    @Excel(name = "商品编号")
    @ApiModelProperty("商品编号")
    private String code;

    /**
     * 返佣
     */
    @ApiModelProperty("返佣")
    private BigDecimal rebate;

    /** 标题 */
    @Excel(name = "标题")
    @ApiModelProperty("标题")
    private String title;

    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty("备注")
    private String remake;

    /** 分类id */
    @Excel(name = "分类id")
    @ApiModelProperty("分类id")
    private Long categoriesId;

    /** 商品图片 */
    @Excel(name = "商品图片")
    @ApiModelProperty("商品图片")
    private String image;

    /** 商品市场价格 */
    @Excel(name = "商品市场价格")
    @ApiModelProperty("商品市场价格")
    private BigDecimal marketPrice;

    /** 商品供货价格 */
    @Excel(name = "商品供货价格")
    @ApiModelProperty("商品供货价格")
    private BigDecimal shopPrice;

    /**
     * 设置缩略图第一张
     * @param image
     */
    public void setImage(String image) {
        String[] split = image.split(",");
        if (split.length>0){
            this.image = split[0];
        }else {
            this.image="";
        }
    }
}
